<template>
    <div>
      <!--      同时使用过度和动画-->
      <transition name="fade"
                  type="transition"
                  :duration="{enter:2000,leave:2000}"
                  appear
                  enter-active-class="animated swing fade-enter-active"
                  leave-active-class="animated shake fade-leave-active"
                  appear-active-class="animated swing"
      >
        <!--          type="transition" 设置动画是以transition时间为标准结束还是animate时间为标准结束-->
        <!--          appear-active-class 在页面刷新的时候展示动画效果-->
        <!--         :duration="5000" 自定义动画时长 在此结束后才移除class-->
        <div v-if="show">hello world</div>
      </transition>
      <button @click="change">切换</button>
    </div>
</template>

<script>
export default {
  name: 'baseAnimate',
  data () {
    return {
      show: true
    }
  },
  methods: {
    change () {
      this.show = !this.show
    }
  }
}
</script>

<style scoped>
  .fade-enter,.fade-leave-to {
    opacity: 0;
  }
  .fade-enter-active {
    transform-origin: left center;
    transition: opacity 1s;
  }
  .fade-leave-active {
    transform-origin: left center;
    transition: opacity 1s;
  }
</style>
